$(document).ready(function () {
	//Add active for first news lastest
	$(".right_inner ul.newsListing li:eq(0)").addClass("active");
	$(".right_inner ul.newsListing li:eq(0)").append("<span class=\"arrow-active\"></span>");
	
	$(".right_inner ul.newsListing li").click(function () {
		if (!$(this).hasClass("active")) {
			//Remove all active class
			$(".right_inner ul.newsListing li").removeClass("active");
			$(".right_inner ul.newsListing li span").remove();
			
			//Add active class for li current
			$(this).addClass("active");
			$(this).append("<span class=\"arrow-active\"></span>");
			
			//Get data
			var form_data = {					
					id: $(this).find("a").attr("id"),
				};	
			
			$.ajax({
				type: "POST",
				url: "ajax_lastest_news",
				data: form_data,
				dataType: "json",
				success: function(response)
				{
					$("#news .left_inner h1.heading-page").html(response.title);
					$("#news .left_inner .newsInfo .left").html(response.date);
					$("#news .left_inner .newsInfo .right").html(response.comments);
					$("#news .left_inner .newsContent img").attr("src", response.pic);
					$("#news .left_inner .newsContent .newsDes").html(response.description);
					$("#news .left_inner .newsContent .content").html(response.content);
					$("#news .left_inner").hide().fadeIn(500);
					
					//Remove comment open
					$("#newsComment .openComment").html("Open Comments");
					$("#newsComment .openComment").removeClass("open");
					$("#newsComment .openComment").removeClass("close");
					$("#newsComment .newsCommentForm ").fadeOut(500);
					$("#newsComment .commentListing").fadeOut(500);
				}
			});
		}
		
		return false;
	});
	
});